import request from '@/utils/request'

export function spuSave(data) {
  return request({
    url: '/product/spu/save',
    method: 'post',
    data
  })
}

export function spuUpdate(data) {
  return request({
    url: '/product/spu/update',
    method: 'post',
    data
  })
}

export function getSpuById(id) {
  return request({
    url: `/product/spu/getVoById/${id}`,
    method: 'get',
  })
}

export function deleteSpu(id) {
  return request({
    url: `/product/spu/delete/${id}`,
    method: 'get',
  })
}

export function findSpu(params) {
  return request({
    url: '/product/spu/find',
    method: 'get',
    params
  })
}

export function listSpu(params) {
  return request({
    url: '/product/spu/list',
    method: 'get',
    params
  })
}

export function spuUp(id) {
  return request({
    url: `/product/spu/sale/${id}`,
    method: 'get'
  })
}

export function spuDown(id) {
  return request({
    url: `/product/spu/soldOut/${id}`,
    method: 'get'
  })
}

export function getSpuSaleAttr(spuId) {
  return request({
    url: `/product/spu/getSaleAttrBySpuId/${spuId}`,
    method: 'get',
  })
}
